home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
EDUCATE
/
SM20A.ARJ
/
SYMBMATH.DOC
< prev
next >
Wrap
Text File
|
1992-04-16
|
39KB
|
1,017 lines
SymbMath 2.0: A Symbolic Calculator with Learning
(Version 2.0)
Copyright (C) 1990-1992
by Dr. Weiguang HUANG
5/6 Cara Road, Geelong, Vic. 3216, Australia
Phone: (052)443282
This is Part One of manual. Please read Part Two in the file
SymbMath.DO2.
This manual is uncompleted at the moment (April 15, 1992) as
SymbMath is growing. Welcome to report any error or suggestion
in this manual to the author.
Contents
1. Introduction
2. Capabilities
3. A List of Files in SymbMath Package
4. Pull-down Menu and Pop-up Menu
4.1 File Menu
4.2 Edit Menu
4.3 Run Menu
4.4 Output Menu
4.5 Color Menu
4.6 Help Menu
4.7 Print Menu
4.8 Edit Help Menu
5. Programming in SymbMath
6. Data Types
6.1 Numbers
6.2 Constants and Built-in Constants
6.3 Variables and Built-in Variables
6.4 Functions
6.4.1 Built-in Standard Functions
6.4.2 Calculus and Transformation Functions
6.4.3 User-defined Functions
6.5 Equations
6.6 Lists, Arrays, Vectors and Matrices
6.7 List Index
7. Operators
8. Expressions
9. Statements
9.1 Comment Statement
9.2 Evaluation Statement
9.3 Assignment Statement
9.4 Switch Statement
9.5 Command Statement
9.6 Compound Statement
9.7 End Statement
13. Library
15. Examples
15.1 Declaration and Simplification
15.2 Calculation
15.3 User-defined Function and Evaluation
15.4 Limits
15.5 Differentiation
15.6 Integration
15.7 Algebraic Equations
15.8 Differential and Integral Equations
15.9 Sums and Products
15.10 Series
15.11 Lists, Arrays, Vectors and Matrices
15.12 Complex Analysis
15.13 Tables of Function Values
15.14 Transformation and Pieces of Expressions
15.15 Chemical Calculation
15.16 Chemical Reactions
15.17 Learning from Users
15.17.1 Learning complicated indefinite integrals
from a simple indefinite integral
15.17.2 Learning definite integral from indefinite integral
15.17.3 Learning integral from derivative
15.17.4 Learning integral from algebra
15.17.5 Learning complicated derivatives from a simple
derivative
15.17.6 Learning complicated algebra from simple algebra
16. Interface with Other Software
16.1 With PlotData for Graph
17. Inside SymbMath
18. System Limits
19. Future
20. Keywords
20.1 Keywords in Alphabetical Order
20.2 Keywords in Functional Order
20.3 Keywords Dictionary
21. References
1. Introduction
SymbMath (an abbreviation for Symbolic Mathematics) is not
only a symbolic calculator but also an expert system that can solve
symbolical math problems. SymbMath will also perform exact numeric
computation. It can manipulate complicated formulas and return answers
in terms of symbols, formulas and exact numbers.
SymbMath is different from other software.
(1) It is able to learn from users. If users only input one
formula (e.g. one derivative) without writing any code,
it will automatically learn many problems (e.g.
derivatives, indefinite and definite integrals) related
to this formula.
(2) Users can easily edit the library (e.g. integral tables)
in "formula format".
(3) It requires only 640 KBytes RAM, so it can run on small
IBM PCs under MS-DOS.
2. Capabilities
Its capabilities include facilities to provide analytical and
numerical answers for:
o Differentiation: regular or higher order, partial or
total, mixed and even implicit differentiation,
one-sided derivatives.
o Integration: indefinite or definite integration,
multiple integration, infinity as a bound, parametric
integration, iterated integration, line or surface
integrals, discontinuous or implicit integration.
o Solution of equations: roots of a polynomial, systems of
algebraic or differential equations.
o Manipulation of expressions: simplification,
factoring or expansion, substitution, evaluation,
user-defined functions, built-in standard functions,
over 80 internal functions.
o Calculation: exact and floating-point numerical
computation of integer, rational, real and complex
numbers in the range from minus to plus infinity, even
with different units.
o Limits: real or complex limits, one-sided limits,
indeterminate forms.
o Complex: calculation, functions, derivatives, integration.
o Sum and product: finite or infinite, partial.
o Chemical calculation: molecular and atomic weights,
concentrations (all by entering the symbols of the
chemical elements).
o Chemical reactions: inorganic and organic.
o Other: series, lists, arrays, vectors, matrices, etc.
Also included are:
o Pull-down and pop-up menus, sizable and colourable windows.
o Twin screen text editor with syntax check.
o Programming in integrated edit-interpret-debug environment.
o Reading and generating BASIC and FORTRAN codes.
o Displaying two-dimensional math notation.
o On-line help, and on-line manual.
o Interface with other software (e.g. with PlotData for graph).
Its shareware version (SM20A.ZIP) is available free from the
Calculator directory in SIMTEL20 archives on many anonymous FTP sites
(wsmr-simtel20.army.mil, rana.cc.deakin.oz.au, garbo.uwasa.fi, etc) or
by e-mail from listserv@vm1.nodak.edu, listserv@ndsuvm1.bitnet.
SymbMath is growing though it has limited features at the
moment.
3. A List of Files in SymbMath Package
-------------------------------------------------------------------------
SymbMath.exe executable SymbMath system.
SymbMath.ini initial file.
SymbMath.sys configuration file.
SymbMath.hlp help file, how to use help.
SymbMath.hl2 help file, the list of the edit commands.
SymbMath.hl3 help file, the list of keywords.
SymbMath.hl4 help file, the keywords dictionary.
SymbMath.txt introduction of SymbMath.
SymbMath.doc part one of document file or manual file.
SymbMath.do2 part two of document file or manual file.
readme read me file, the latest updates and suggestion about
SymbMath.
*.li library files.
*.sm user program files.
problem.txt problems that other software cannot solved, but
SymbMath can do.
comment*.txt comments on SymbMath.
statis.txt the download statistics at FTP site of garbo.uwasa.fi.
exerci*.* exercise from the textbook.
prolog.err error messages.
shareware.txt shareware concept.
software.txt software available from the author Dr. W.Huang.
prolog.log log file of SymbMath.
------------------------------------------------------------------------
SymbMath has three versions: Shareware, Student and Advanced
versions.
4. Pull-down Menu and Pop-up Menu
The screen is divided into four areas: menu line, edit window,
output window, and status line.
The menu line has 6 pull-down menus:
------------------------------------------------------
| File Edit Run Output Color Help |
------------------------------------------------------
and 2 pop-up menus: print and edit help.
Select the menu by the arrow keys or the first capital letter.
4.1 File Menu
The File menu has 6 choices in the pull-down menu:
-----------
|Load |
|New File |
|Save |
|Directory|
|OS shell |
|Quit |
-----------
The "Load" command loads a file from a disk into the editor.
The "New file" command creates a new file.
The "Save" command saves the program in the editor into a disk.
The "Directory" command changes the current directory.
The "OS shell" command executes a DOS command and automatically
returns to the SymbMath system if users provide a special DOS command on
the command window, otherwise it goes to the DOS shell, control must be
returned to the resident SymbMath system with the EXIT command on the
DOS shell.
The "Quit" command exit from SymbMath.
4.2 Edit Menu
SymbMath includes twin screen text editor for creating and
modifying program files. Usage of the editor is similar to WordStar
in nondocument mode, or to Borland's SideKick, or editor in C
compiler. The problem files are ordinary ASCII files, and can be
edited with any other text editor.
Within the Edit window, press <F1> to pop-up the Edit Help
menu (see 4.7 Edit Help Menu), or <Shift><F1> to call the manual.
As the twin screen editor, use <F8> to call an auxiliary
editor in another window, and <F7> to copy block from the auxiliary
editor into the main editor.
You can move the cursor around in the editor with the arrow
keys, <Page Up>, <Page Down>, and some other keys listed below. The
editor has two typing modes, Insert and Overwrite. In Insert
mode, anything you type is inserted at the cursor position. In
Overwrite mode, pressing a key replaces the current character
at the cursor position with the new typed character. Initially,
the editor operates in Insert mode, to switch modes, press the
<Insert> key or <Ctrl>V. (<Ctrl>V means to hold down the <Ctrl> key
on your keyboard while you press V. The V need not be in upper
case.)
Unlike a more standard word processing program, the editor
does not have word-wrap. You must press <Enter> at the end of each
line.
The editor has an autoindent feature that allows subsequent
lines to automatically indent. If you leave several spaces at the
start of a line, use <Ctrl>OI to indent subsequent lines the same
amount. The command sequence is a toggle, so you need only
press <Ctrl>OI again to stop indenting.
Sometimes you may want to see more than the area covered by
the current window. You can "zoom" the window, expanding it to the
size of the entire screen, by pressing <F5>. To return the window
to its usual size, press <F5> again. For other window commands,
such as moving and resizing a window, see the Window menu, below.
Text in the editor always be saved after exit by press <Esc>.
Table 4.2 Summary of the editing commands.
---------------------------------------------------------------
Cursor Movement Commands (move cursor to):
Character left <Ctrl>S or Left arrow <-
Character right <Ctrl>D or Right arrow ->
Word left <Ctrl>A or <Ctrl> <-
Word right <Ctrl>F or <Ctrl> ->
Line up <Ctrl>E or Up arrow
Line down <Ctrl>X or Down arrow
Scroll up <Ctrl>W
Scroll down <Ctrl>Z
Page up <Ctrl>R or <Pg Up>
Page down <Ctrl>C or <Pg Dn>
Beginning of line <Ctrl>QS or <Home>
End of line <Ctrl>QD or <End>
Top of screen <Ctrl>QE or <Ctrl><Home>
Bottom of screen <Ctrl>QX or <Ctrl><End>
Top of file <Ctrl>QR or <Ctrl><Pg Up>
Bottom of file <Ctrl>QC or <Ctrl><Pg Dn>
Beginning of block <Ctrl>QB
End of block <Ctrl>QK
Previous point <Ctrl>QP
Marker 0 <Ctrl>Q0
Marker 1 <Ctrl>Q1
Marker 2 <Ctrl>Q2
Marker 3 <Ctrl>Q3
Set marker 0 <Ctrl>K0
Set marker 1 <Ctrl>K1
Set marker 2 <Ctrl>K2
Set marker 3 <Ctrl>K3
Insert & Delete Commands:
Insert mode on/off <Ctrl>V or <Ins>
Insert line <Ctrl>N
Delete line <Ctrl>Y
Delete to end of line <Ctrl>QY
Delete left character <Ctrl>H or <Backspace>
Delete character under cursor <Ctrl>G or <Del>
Delete right word <Ctrl>T
Block commands:
Mark block begin <Ctrl>KB
Mark block end <Ctrl>KK
Mark word <Ctrl>KT
Hide block <Ctrl>KH
Copy block <Ctrl>KC or <F5>
Repeat the last copy <Shift><F5>
Move block <Ctrl>KV or <F6>
Delete block <Ctrl>KY
Read block <Ctrl>KR or <F7>
Write block <Ctrl>KW
Print block <Ctrl>KP
Miscellaneous Commands:
Quit edit <Esc>, <F10>, <Ctrl>KD, or <Ctrl>KQ
Call the auxiliary editor <F8>
Tab <Ctrl>I or <Tab>
Tab mode toggle <Ctrl>OT
Auto indent on/off <Ctrl>OI
Restore line <Ctrl>QL
Find <Ctrl>QF or <Ctrl><F3>
Repeat last find <Ctrl>L or <Shift><F3>
Find & replace <Ctrl>QA or <Ctrl><F4>
Repeat last find & replace <Ctrl>L or <Shift><F4>
Control key prefix <Ctrl>P
Abort operation <Ctrl>U
Restore error message <Ctrl>QW
Search Options:
L Local search
G Global search
N Replace without asking
Y Replace with asking
------------------------------------------------------------------
4.3 Run Menu
The Run menu interprets the user program in the main editor,
runs it into memory, and outputs the results in the output window.
4.4 Output Menu
The Output menu has 3 choices:
__________
|To disk |
|Off disk|
|Window |
----------
The "To disk" command forces the output to a disk file.
The "Off disk" command returns the output control from the
disk file to the output window.
The "Window" command changes the output window size.
SymbMath can write output to screen, a disk and a printer.
Users select the "To disk" command in the Output window to
force output to a disk file, and select the "Off disk" command to
return the output into the Output window (screen). These output in
the disk file can be read back into SymbMath by selecting the command
"Load" in the File menu, but only the output in BASIC format can be
run. Therefore, use the BASIC output format by setting the switch
Output=BASIC when you write the output into a disk file.
A reserved word "last" is the last output.
4.5 Color Menu
The Color menus has 4 choices in the pull-down menu:
---------------
|Menu line |
|Edit window |
|Output window|
|Status line |
---------------
When users choose one of them, the color pattern will come up.
Users select the favor color by the arrow keys and <Enter>.
4.6 Help Menu
The Help menu has 4 choices in the pull-down menu:
-------------
|How to help|
|Editor |
|Keywords |
|Dictionary |
-------------
Each has its own help window and help file. The on-line help
files are text (ASCII) files.
In the help window, to search for a special word, you first
press <Ctrl><F3>, then type the word you want to search, finally
press <Ctrl><F3> again. e.g. if you want to search for the word
"help", you first press <Ctrl><F3>, then type "help", finally
press <Ctrl><F3> again. The cursor will go to the word "help".
You press <Shift><F3> to repeat the last find.
The commands within the help window are the same as that
within the edit window, except that text is unable to be changed.
Table 4.5 Commands Within the Help window
-------------------------------------------------------------------
Commands Action
arrows keys move the cursor.
<F5> zoom the window, <F5> again to zoom out.
<Esc> exit from the window.
<F10> exit from the window, the same as <Esc>.
<PgUp> page up.
<PgDn> page down.
<F2> go to nth line, end by <F2> instead of <Enter>.
<Ctrl><F3> find the special word, end by <Ctrl><F3>
instead of <Enter>.
<Shift><F3> repeat last find.
<Shift><F10> re-size window by arrow keys.
----------------------------------------------------------------------
There are other two help windows in the Edit window, press
<F1> to pop-up the Edit Help Menu, or <Shift><F1> to call the manual
window.
4.7 Print Menu
Users pop-up the Print Menu by <Alt>P, and set "Printer On" in
the Print window to toggles echoing to a printer, or/and set "Log File
On" to toggles echoing to the log file "Prolog.Log".
Another way to print, by using MS-DOS screen print command
<Print Screen>, everything on screen is printed out.
4.8 Edit Help Menu
Users pop-up the Edit Help menu by pressing <F1> within the
editor.
This menu has 7 choices:
------------------
|Show help file |
|Cursor movement |
|Insert & Delete |
|Block functions |
|Wordstar-like |
|Miscellaneous |
|Global functions|
------------------
Except for the first choice of the show help file, others have their own
sub-menu. Users can select the edit command from the sub-menu.
5. Programming in SymbMath
SymbMath is an interpreter, and accepts a program from the
SymbMath Editor or a disk. It runs the program written by any editor
in the text (ASCII) file format. After the first program was run into
memory, users can call any part of the first program from a second
program, as it seems the part of the first program has already been in
the second program. Users can run many programs into SymbMath at a time.
However, all names of the variables are public and name conflicts
must be avoided.
Users can clear all of them from memory by the command
"clear_all". Note that the switch library "Switch.Li" should be run
after clearing all from memory by "clear_all", otherwise the default
switches may be changed.
SymbMath language is procedure language, which is executed
from top to bottom in a program, like BASIC, FORTRAN, or PACSAL.
It also is an expression-oriented language. SymbMath program
consists of a number of statements. The most useful statement
contains expressions, the expression includes data, and the most
important data is functions.
The structure of SymbMath language is:
data -> expression -> statement -> program
Note that upper and lower case letters are different in
SymbMath language, e.g. abc is different from ABC.
6. Data Types
Data in SymbMath language is the numbers, constants, variables,
functions, equations, lists, arrays, vectors, matrixes, and list index.
All data can be operated.
6.1 Numbers
The types of numbers are integer, rational, floating-point,
power, real and complex numbers in the range from -infinity to
infinity.
In fact, the range of the input real numbers is
-inf, -(10^307)^(10^307) to -(10^-307)^(10^-307), 0, (10^-307)^(10^-307)
to (10^307)^(10^307), inf.
The range of the output real numbers is the same as input
when the switch Numerical=Off, but when the switch Numerical=On, it is
-inf, -1.E307 to -1.E-307, 0, 1.E-307 to 1.E307, inf.
It means that the number larger than 1.e307 is converted
automatically to inf, the absolute values of the number less than
1.e-307 is converted to 0, and the number less than -1e307 is
converted to -inf.
For examples:
-------------------------------------------
Numbers Type
23 integer
2/3 rational
0.23 floating-point
2.3E2 floating-point
2.3e-2 floating-point
2.3*10^20 power
10^1.E200 power
2+3*i complex
inf real
inf+i complex
3.14+inf*i complex
inf+inf*i complex
---------------------------------------------
The real numbers include the integer, rational, floating-
point, and power numbers. They may be different when the switch
Numerical=Off, and are the same when the switch Numerical=On (i.e.
all converted to the floating-point numbers). That "a" and "b" are
the same means a-b = 0, while that they are different means a-b<>0.
For the floating-point numbers, the upper and lower case letters E
and e are the same, e.g. 1e2 is the same as 1E2.
6.2. Constants and Built-in Constants
Constants are the unchangable values. There are some built-in
constants. The name of these built-in constants should be avoided in
the user-defined constants.
------------------------------------------------------------------
Built-in Constants Meanings
pi=3.1415926536 the circular constant.
e=2.7182818285 the base of the natural logarithms.
1/2
i=(-1)
inf infinity.
-inf negative infinity.
constant the integral constant
discont discontinuity, e.g. 1/0. Evaluate the one-
sided value by x=c+zero or c-zero if the
value of expr is discont.
c-zero approach c from negative (-inf) direction,
limit as zero ->0.
c+zero approach c from positive (+inf) direction,
limit as zero ->0.
undefined the undefined value, e.g. indetermiate forms:
0/0, inf/inf, 0*inf, 0^0, etc.
--------------------------------------------------------------------
Notice that the constants discont and undefined are
different. If the value of an expression at x=c is discont, the
expression only has the one-sided value at x=c and this one-sided
value is evaluated by x=c+zero or x=c-zero. If the value of an
expression at x=c is undefined, the expression may be evaluated by
the function lim().
e.g. evaluate 1/sgn(x) and sin(x)/x at x=0.
Input:
define(f(x)=1/sgn(x))
f(0)
f(0+zero)
Output:
defined
discont
1
Input:
f2=sin(x)/x
subs(x=0, f2)
lim(x=0, f2)
Output:
f2 = sin(x)/x
undefined
1
6.3. Variables and Built-in Variables
The sequence of characters is used as the name of variables.
The usual used independent variable is "x". A value can be assigned
to the variable, by (1) the assignment "=", (2) the user-defined
function f(), (3) the function subs(). e.g. (1) x=2, (2) f(2) if
f(x)=x^2 has been defined, (3) subs(x=2 to x^2).
The built-in variable is "last". The variable "last" is
always be assigned the value of the last output.
6.4. Functions
6.4.1 Built-in Standard Functions
Different versions of SymbMath have different built-in
standard functions. The Advanced Version C has all of them. See
the following table in detail for other versions. All below standard
functions except n! or fac(n) can be differentiated and integrated
symbolically.
Table 6.1 Built-in Standard Functions
-----------------------------------------------------------------------
Functions Meanings
n! factorial of n.
fac(n) the same as n!.
sqrt(x) square root, the same as x^0.5.
exp(x) the same as e^x.
sgn(x) 1 when Re(x) > 0, or Re(x) = 0 and Im(x) > 0; 0 when
x=0; -1 otherwise.
abs(x) absolute value of x.
............... above functions in Shareware Version A ...............
ln(x) natural logarithmic function of x, based on e.
sin(x) sine function of x.
cos(x)
tan(x)
csc(x)
sec(x)
cot(x)
asin(x) arc sine function of x, the inverse of sin(x).
acos(x)
atan(x)
acot(x)
asec(x)
acsc(x)
............... above functions in Student Version B .................
sinh(x) hyerbolic sine function of x.
cosh(x)
tanh(x)
csch(x)
sech(x)
coth(x)
asinh(x) arc hyerbolic sine function of x, the inverse of sinh(x).
acosh(x)
atanh(x)
acoth(x)
asech(x)
acsch(x)
erf(x) error function, or probability integral function of x.
--------------------------------------------------------------------------
6.4.2 Calculus and Transformation Functions
Calculus functions are for calculus calculation while trans-
formations functions are to move or take a piece of expression.
Table 6.2 Calculus Functions
----------------------------------------------------------------------
Functions Meanings
subs(x=c, y) substitutes x by c in y.
subs(x=c to y) the same as subs(x=c,y).
lim(x=c, y) gives the limit of y when x approaches c. Note that
the correct answers only for the indeterminate forms:
0/0, inf/inf, 0*inf, 0^0, inf^0.
d(y, x=c) gives the derivative of y with respect to an undefined
variable x at x=c.
d(y, x=c, n) gives the nth order derivative of y with respect to an
undefined variable x at x=c.
d((y)/d(x)) differentiate y with respect to x.
d((y)/d(x)), n) gives the nth order derivative of y with respect to an
undefined variable x.
d(y) implicit differentiation, used in differential equations,
e.g. x*d(x)+y*d(y) == 0.
inte(y,x,a,b) find the definite integral of y with respect to an
undefined variable x taken from x=a to x=b.
inte(y, x from a to b) the same as inte(y,x,a,b).
inte((y)*d(x)) find the indefinite integral of y with respect to an
undefined variable x.
inte(y) implicit integration, used to integrate the differential
equations
sum(y, x from a to b step c) sum of y.
sum(y, x from a to b) sum of y step=1.
sum([y]) transform list to sum
prod(y, x from a to b step c) product of y.
prod(y, x from a to b) product of y step=1.
---------------------------------------------------------------------
Table 6.3 Transformation Functions
---------------------------------------------------------------------
expand(F) expand F, e.g. expand((a+b)^2) gives a^2 + 2*a*b + b^2.
factor(F) factorise from F, e.g. factor(a^2 + 2*a*b + b^2) gives
(a+b)^2.
solve(F==0, x) solve polynomial equation, systems of linear equations,
linear differential equations.
list(y, x from a to b step c) lists of y
list(y) transform sum to list
table(y, x from a to b step c) data table
coef(expr, x^n) gives the coefficient of x^n in expr.
assume(x>0) assume x>0.
assume(x<0) assume x<0.
assume(x == real) assume x is real.
left(eq) left hand side of an equation.
right(eq) right hand side of an equation.
re(x) real part of complex numbers.
im(x) imaginative part of complex numbers.
nume(a/b) numerator of division, i.e. a.
deno(a/b) denominator of a/b, i.e. b.
-----------------------------------------------------------------------
For example:
---------------------------------------------------------
differentiation diff() d((x^2)/d(x))
integration inte() inte((x^2)*d(x))
limit lim() lim(x=0, sin(x)/x)
solving solve() solve(x^2+1==0, x)
expanding expand() expand((a+b)^2)
factoring factor() factor(a*c+b*c)
-----------------------------------------------------------
where "x" is an undefined variable.
Above functions can be operated and chained, like the standard
functions.
If the undefined variable d(x) is omitted in the functions d(y)
and inte(y), they are implicit derivatives and integrals. If f(x) is
undefined, d(f(x)/d(x)) is differentiation of f(x). These are useful in
the differential and integral equations. (see later chapters).
For examples:
inte(inte(F * d(x)) * d(y)) is double integral with respect
to both variables x and y.
d(d(y/d(x)) x=c) is the second order derivative of y with
respect to x at x=c.
d(d(y/d(x))/ d(t)) is the mixed derivative of y with respect
to x and t.
d((y)/d(x)) is different from d(y)/d(x): (1) d((y)/d(x)) is
an operation of differentiation, while d(y)/d(x) is not; (2) y and d(x)
is inside the same () in d((y)/d(x)), while d(y) and d(x) can be
separated in d(y)/d(x). d(y)/d(x) is the same as y', d(x) can be
operated.
The keywords "from" "to" "step" "," are the same as separators
in multi-arguement functions. e.g. inte(f(x), x, 0, 1) are the same as
inte(f(x), x from 0 to 1).
The Shareware Version has not solve(), while the Student
Version and the Advanced Version have all of these functions.
6.4.3 Users-defined Functions
Users can define the new functions, which include the
standard functions, calculus functions, and algebraic operators.
Users define a new function f(x) by define(),
define(f(x)=x^2)
and then call f(x) as the standard functions. The function name can
be any name, except for the keywords. The maximum number of arguments
in the users-defined functions on this version is 2, e.g. f(x) and
f(x,y).
Alternately, users assign x^2 to a variable f by f=x^2, and
then call the variable f by subs(x=c to f). f=x^2 seems a function.
To clears a variable or function from memory by
clear(x) clear x from memory.
clear(f(x)) clear f(x) from memory.
clear_all clear all from memory.
Note that the switch library "Switch.Li" should be run after
clearing all from memory by "clear_all", otherwise the default switches
may be changed.
6.5 Equations
An equation is an equality of two sides linked by an equation
sign "==", e.g. x^2+p == 0, where the symbol "==" stands for an
equation. Note the symbols "==" and "=" are different. Systems of
equations are a list of equations, e.g. [a1*x+a2*y==a3, b1*x+b2*y==b3].
6.6 Lists, Array, Vectors and Matrices
A list is [a, b, c].
An array is a list of lists. e.g. [a, b, [c1, c2]].
A vector and matrix are similar a list and array, but in a
matrix, the number of elements in each row should be the same, e.g.
[[a11, a12], [a21, a22]].
6.7 List Index and Built-in List Index
The list index is the index for n-th element in a list. e.g.
b[2] indicates the second element in the list b.
The built-in list index is last[number]. The name of last
output list is "last", e.g. last[1] is the first element in the
last output list.
7. Operators
Table 7.1 Operators
-----------------------------------------------------------------
Operation Operators Examples Order
comma , a=2, b=3 1
assignment = p=2+b 2
equation == x^2+x+1==0 3
equal == a==2 3
larger than > a>2 3
larger and equal >= a>=2 3
less than < a<2 3
less and equal <= a<=2 3
unequal <> a<>2 3
plus + a+b 4
minus - a-b 4
mutilation * a*b 5
division / a/b 5
power ^ a^b 6
power ** a**b 6
factorial ! n! 6
positive + +a 7
negative - -a 7
function f() sin(x) 7
list index f[] f[1] 7
parentheses () (a+b)*c 7
list [] [a,b] 7
--------------------------------------------------------------------
All functions have the same 7th order.
Operations with higher order precede, otherwise operations are
performed left to right. These are the usual algebraic conventions.
a^b^c is the same as (a^b)^c.
8. Expressions
An expression (i.e. expr) is combination of data and operators.
e.g. a+b-f(c).
9. Statements
The statements include:
comment statement
evaluation statement
assignment statement
switch statement
command statement
compound statement
end statement
SymbMath program must be terminated by the end statement.
9.1 Comment Statement
# is the comment statement sign.
You can add comments into a line, or even produce a single line
which is entirely a comment, by preceding the comment sign with #.
For example:
# This is my program
3 + 4 # My first calculation
Comments make your calculations more understandable, whether you
are making a printed record of what you are doing or if you just
want to jot some notes to yourself while you are working.
9.2 Evaluation Statement
The evaluation statement has the format:
expression
SymbMath evaluates any expression which in a line and gives
the value of the expression. e.g.
Input:
3 + 4
Output:
7 # the value of 3+4
Input:
d(x^6/d(x))
Output:
6 x^5 # the value of d(x^6/d(x))
The last output can be saved to a variable for the later use
by the built-in variable "last", e.g. f=last.
9.3 Assignment Statement
The assignment statement specifies that a new value of
expression_2 be assigned to expression_1, and saved into memory. The
form of an assignment is
expression_1 = expression_2
where "=" is the assignment operator.
Note that not only a single variable but also an expression
can be assigned. e.g. x=2, sin(x)/cos(x)=tan(x).
e.g. evaluate of d() and assign the result (6*x^5) to f.
f=d(x^6/d(x))
9.4 Switch Statement
The switch statement sets or changes the switch status. The
switch status is unchanged in memory until the new switch status is
assigned.
----------------------------------------------------------------------
Switch Action
Numerical=On convert numbers to floating-point numbers.
Numerical=Off not convert numbers to floating-point numbers,
this is default.
NumIntegrate=Off disable numerically integration, this is default.
NumIntegrate=On numerically integration.
Output=TwoDim display output in two dimension, this is default.
Output=BASIC display output in BASIC format.
Output=FORTRAN display output in FORTRAN format.
Output=Off not display output.
ExpExpand=On exponent expansion. e.g. c^(a+b) to c^a*c^b.
ExpExpand=Off disable exponent expansion, this is default.
LnExpand=On log expand, e.g. ln(a*b) to ln(a)+ln(b)
LnExpand=Off disable log expansion, this is default.
----------------------------------------------------------------------
Remember that first letter of the switch is upper case, and
first letter of words are upper case, too. e.g. TwoDim means two
dimension.
9.5 Command Statement
The command statement neither evaluates any expression nor
saves any expression. It executes a command.
----------------------------------------------------------------------
Commands Action
last the last output.
last[1] the first element of the last output list.
show_all show all the variables in memory.
clear(y) clear the variable y from memory.
clear_all clear all the variables from memory.
system(xx) execute the MS-DOS command xx.
end the end of the program and library files.
---------------------------------------------------------------------
9.6 Compound Statement
The all above statements are simple statements. The compound
statement specifies that its component statements are to be executed
in the same sequence as they are written. They are separated by the
separators (comma ","). e.g.
a+b, 2+3
9.7 End Statement
Program must be terminated by the end statement. The end statement
is "end" in a single last line.
end
13. Library
A library is a text file with a table of formula in
mathematical notation, so users can edit them by any text (ASCII)
editor. In order to expand the special ability of SymbMath, some
libraries should be run. The library is loaded into the Editor by the
command "Load" in the "File" menu, and then run into memory. Many
libraries can be run into memory at a time, however, all names of the
variables are public and name conflicts must be avoided.
Users can clear all of them from memory by "clear_all". Note
that the switch library "Switch.Li" should be run after clearing
all from memory by "clear_all", otherwise the default switches may be
changed.
Alternately, a part of the library file rather than the whole
library file can be copied into the Editor by pressing <F7> (external
copy) and then run into memory in order to save memory.
There are many libraries. The following are some of them.
Table 13.1 Library
------------------------------------------------------------------------
File Name Library Function
Switch.Li switches on the default state.
Units.Li an units conversion.
Function.Li the user-defined functions.
Trig.Li reduction of trig functions.
Hyerboli.Li reduction of hyerbolic functions.
Integral.Li integrals.
Derivati.Li derivatives of special functions.
Diff.Li to find total derivatives, and implicit
derivatives of an equation on one step.
Chemical.Li the atomic weight of chemical elements.
Inorgani.Li inorganic chemical reactions.
Organic.Li organic chemical reactions.
-----------------------------------------------------------------------
(continued in SymbMath.DO2)